package dto

import (
    "time"

    "go-admin/app/hunter/models"
    "go-admin/common/dto"
    common "go-admin/common/models"
)

type HtDeliverGetPageReq struct {
    dto.Pagination `search:"-"`
    TalentId       string `form:"talentId"  search:"type:exact;column:talent_id;table:ht_deliver" comment:"人才id"`
    Company        string `form:"company"  search:"type:contains;column:company;table:ht_deliver" comment:"公司名称"`
    Department     string `form:"department"  search:"type:contains;column:department;table:ht_deliver" comment:"部门名称"`
    Salary         string `form:"salary"  search:"type:contains;column:salary;table:ht_deliver" comment:"薪酬"`
    BeginTime      string `form:"beginTime" search:"type:gte;column:join_time;table:ht_deliver" comment:"入职时间"`
    EndTime        string `form:"endTime" search:"type:lte;column:join_time;table:ht_deliver" comment:"入职时间"`
    Note           string `form:"note"  search:"type:contains;column:note;table:ht_deliver" comment:"备注信息"`
    NameOrPhone    string `form:"nameOrPhone" search:"-" comment:"姓名或电话"`
    HtDeliverOrder
}

type HtDeliverOrder struct {
    Id         string `form:"idOrder"  search:"type:order;column:id;table:ht_deliver"`
    TalentId   string `form:"talentIdOrder"  search:"type:order;column:talent_id;table:ht_deliver"`
    Company    string `form:"companyOrder"  search:"type:order;column:company;table:ht_deliver"`
    Department string `form:"departmentOrder"  search:"type:order;column:department;table:ht_deliver"`
    Salary     string `form:"salaryOrder"  search:"type:order;column:salary;table:ht_deliver"`
    JoinTime   string `form:"joinTimeOrder"  search:"type:order;column:join_time;table:ht_deliver"`
    Note       string `form:"noteOrder"  search:"type:order;column:note;table:ht_deliver"`
    CreateBy   string `form:"createByOrder"  search:"type:order;column:create_by;table:ht_deliver"`
    UpdateBy   string `form:"updateByOrder"  search:"type:order;column:update_by;table:ht_deliver"`
    CreatedAt  string `form:"createdAtOrder"  search:"type:order;column:created_at;table:ht_deliver"`
    UpdatedAt  string `form:"updatedAtOrder"  search:"type:order;column:updated_at;table:ht_deliver"`
    DeletedAt  string `form:"deletedAtOrder"  search:"type:order;column:deleted_at;table:ht_deliver"`
}

func (m *HtDeliverGetPageReq) GetNeedSearch() interface{} {
    return *m
}

type HtDeliverInsertReq struct {
    Id         int        `json:"-" comment:"id"` // id
    TalentId   int        `json:"talentId" comment:"人才id"`
    Company    string     `json:"company" comment:"公司名称"`
    Department string     `json:"department" comment:"部门名称"`
    Salary     string     `json:"salary" comment:"薪酬"`
    JoinTime   *time.Time `json:"joinTime" comment:"入职时间"`
    Note       string     `json:"note" comment:"备注信息"`
    common.ControlBy
}

func (s *HtDeliverInsertReq) Generate(model *models.HtDeliver) {
    if s.Id == 0 {
        model.Model = common.Model{Id: s.Id}
    }
    model.TalentId = s.TalentId
    model.Company = s.Company
    model.Department = s.Department
    model.Salary = s.Salary
    model.JoinTime = s.JoinTime
    model.Note = s.Note
    model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
}

func (s *HtDeliverInsertReq) GetId() interface{} {
    return s.Id
}

type HtDeliverUpdateReq struct {
    Id         int        `uri:"id" comment:"id"` // id
    TalentId   int        `json:"talentId" comment:"人才id"`
    Company    string     `json:"company" comment:"公司名称"`
    Department string     `json:"department" comment:"部门名称"`
    Salary     string     `json:"salary" comment:"薪酬"`
    JoinTime   *time.Time `json:"joinTime" comment:"入职时间"`
    Note       string     `json:"note" comment:"备注信息"`
    common.ControlBy
}

func (s *HtDeliverUpdateReq) Generate(model *models.HtDeliver) {
    if s.Id == 0 {
        model.Model = common.Model{Id: s.Id}
    }
    model.TalentId = s.TalentId
    model.Company = s.Company
    model.Department = s.Department
    model.Salary = s.Salary
    model.JoinTime = s.JoinTime
    model.Note = s.Note
    model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
}

func (s *HtDeliverUpdateReq) GetId() interface{} {
    return s.Id
}

// HtDeliverGetReq 功能获取请求参数
type HtDeliverGetReq struct {
    Id int `uri:"id"`
}

func (s *HtDeliverGetReq) GetId() interface{} {
    return s.Id
}

// HtDeliverDeleteReq 功能删除请求参数
type HtDeliverDeleteReq struct {
    Ids []int `json:"ids"`
}

func (s *HtDeliverDeleteReq) GetId() interface{} {
    return s.Ids
}
